<!DOCTYPE html>
<html lang="en">
	<head>
    <base href="<?php echo base_url(); ?>"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>海豚护理数据管控平台</title>

		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="ace/assets/css/bootstrap.css" />
		<link rel="stylesheet" href="ace/components/font-awesome/css/font-awesome.css" />

		<!-- page specific plugin styles -->

		<!-- text fonts -->
		<link rel="stylesheet" href="ace/assets/css/ace-fonts.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="ace/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />

		<!--[if lte IE 9]>
			<link rel="stylesheet" href="ace/assets/css/ace-part2.css" class="ace-main-stylesheet" />
		<![endif]-->
		<link rel="stylesheet" href="ace/assets/css/ace-skins.css" />
		<link rel="stylesheet" href="ace/assets/css/ace-rtl.css" />
		<style>
			.widget-header {
				overflow: hidden;
			}
			.widget-header.showctl .widget-toolbar-ctl {
				display: block;
			}
			.widget-header .widget-toolbar-box {
				width: 90%;
				overflow: hidden;
			}
			.widget-header .widget-toolbar {
				width: 9999px;
			}
			
			.widget-toolbar-ctl {
				padding: 6px 8px !important;
				margin-top: 4px !important;
				display: none;
			}
		     .active1{
		    		background-color: white;
		    }
		    .navbar .navbar-nav > li > a:hover{
		    		background-color: red;
			}
			
			#iframe_tab_box .nav-tabs  a .glyphicon{display: none;}
			#iframe_tab_box .nav-tabs .active a .glyphicon{display: inline-block;}
			
			.divhi {
			
			    padding: 14px;
			    padding-bottom: 13px;
			    height: 45px;
			    background-color: transparent;
			    font-size: 13px;
			    color: #ffffff;
			    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
			    cursor: pointer;	}
		</style>

		<!--[if lte IE 9]>
		  <link rel="stylesheet" href="ace/assets/css/ace-ie.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->
		<script src="ace/assets/js/ace-extra.js"></script>

		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

		<!--[if lte IE 8]>
		<script src="ace/components/html5shiv/dist/html5shiv.min.js"></script>
		<script src="ace/components/respond/dest/respond.min.js"></script>
		<![endif]-->
	</head>

	<body class="no-skin">
		<!-- #section:basics/navbar.layout -->
		<div id="navbar" class="navbar navbar-default          ace-save-state">
			<div class="navbar-container ace-save-state" id="navbar-container">
				<!-- #section:basics/sidebar.mobile.toggle -->
				<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler" data-target="#sidebar">
					<span class="sr-only">Toggle sidebar</span>

					<span class="icon-bar"></span>

					<span class="icon-bar"></span>

					<span class="icon-bar"></span>
				</button>

				<!-- /section:basics/sidebar.mobile.toggle -->
				<div class="navbar-header pull-left">
					<!-- #section:basics/navbar.layout.brand -->
					<a href="javascript:;" class="navbar-brand">
						<small>
							<!--<img src="img/joyfitlogoadmin.png" style="height: 25px;" />-->
							海豚护理数据管控平台
							<!--<i class="fa fa-leaf"></i>
							<a href="#" class="navbar-brand">
				            		<?php echo config_item("website_name");?>
				            </a>-->
						</small>
					</a>

					<!-- /section:basics/navbar.layout.brand -->

					<!-- #section:basics/navbar.toggle -->

					<!-- /section:basics/navbar.toggle -->
				</div>
				
				<!--<nav role="navigation" class="navbar-menu pull-left collapse navbar-collapse">
					<ul class="nav navbar-nav">
						<li>
							<a href="#">
								<i class="ace-icon fa fa-envelope"></i>
								电商系统
							</a>
						</li>
						<li>
							<div class="divhi" href="#" style="background-color: white;height: 100%;">
								<i style="color: #307FCD;" class="ace-icon fa fa-envelope"></i>
								<span style="color: #307FCD;">订单系统</span>
							</div>
						</li>
					</ul>
				</nav>-->
				
				<!-- #section:basics/navbar.dropdown -->
				<div class="navbar-buttons navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
		                <!-- #section:basics/navbar.user_menu -->
		                <li class="light-blue">
		                    <a data-toggle="dropdown" href="#" class="dropdown-toggle">
		                        User: 
		                        <?php echo $this->session->userdata["username"];?>
		                        <i class="ace-icon fa fa-caret-down"></i>
		                    </a>
		                    <ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
		                        <li>
		                        		
		                            <a  onclick="return top.openTapWindow($(this));" href="<?php echo site_url('admin/users/changPassword');?>" data-target="menuIframe" data-tab-title="修改密码" >
		                                <i class="ace-icon fa fa-cog"></i>
		                                修改密码
		                            </a>
		                        </li>
		
		                        <li class="divider"></li>
		
		                        <li>
		                            <a href="<?php echo site_url('admin/auth/logout');?>">
		                                <i class="ace-icon fa fa-power-off"></i>
		                                退出登录
		                            </a>
		                        </li>
		                    </ul>
		                </li>
		                <!-- /section:basics/navbar.user_menu -->
		            </ul>
				</div>

				<!-- /section:basics/navbar.dropdown -->
			</div><!-- /.navbar-container -->
		</div>

		<!-- /section:basics/navbar.layout -->
		<div class="main-container ace-save-state" id="main-container">
			<script type="text/javascript">
				try{ace.settings.loadState('main-container')}catch(e){}
			</script>

			<div id="sidebar" class="sidebar                  responsive                    ace-save-state">
				<script type="text/javascript">
					try{ace.settings.loadState('sidebar')}catch(e){}
				</script>

				<ul class="nav nav-list">
					<li class="active">
						<a href="<?php echo site_url('admin/users/userCenter');?>" data-target="menuIframe" data-default-tab="true" data-tab-title="我的首页">
							<i class="menu-icon fa fa-tachometer"></i>
							<span class="menu-text">我的首页</span>
						</a>
						<b class="arrow"></b>
					</li>
					<li class="">
						<a href="#" class="dropdown-toggle">
							<i class="menu-icon fa fa-users"></i>
							<span class="menu-text">会员管理</span>
							<b class="arrow fa fa-angle-down"></b>
						</a>
						<b class="arrow"></b>
						<ul class="submenu">
							<li class="">
								<a href="<?php echo site_url('admin/member/index');?>" data-target="menuIframe"  data-tab-title="会员列表">
									<i class="menu-icon fa fa-caret-right"></i>
									会员列表
								</a>
							</li>
							<li class="">
								<a href="<?php echo site_url('admin/order/ls/0/1');?>"  data-target="menuIframe" data-tab-title="会员分析">
									<i class="menu-icon fa fa-caret-right"></i>
									会员分析
								</a>
							</li>
						</ul>
					</li>
					
					<?php if(checkPermission("011")){  ?>
					<li class="">
						<a href="#" class="dropdown-toggle">
			           	 	<i class="menu-icon 	fa fa-lock"></i>
							<span class="menu-text"> 权限设置 </span>

							<b class="arrow fa fa-angle-down"></b>
						</a>

						<b class="arrow"></b>
						<ul class="submenu">
							<?php if(checkPermission("011001")){  ?>
							<li class="">
								<a href="<?php echo site_url('admin/manager/account/index');?>" data-target="menuIframe" data-tab-title="账号管理">
									<i class="menu-icon fa fa-caret-right"></i>
									账号管理
								</a>
							</li>
							<?php } ?>
							<?php if(checkPermission("011002")){  ?>
							<li class="">
								<a href="<?php echo site_url('admin/manager/permission/index');?>"  data-target="menuIframe" data-tab-title="权限管理">
									<i class="menu-icon fa fa-caret-right"></i>
									权限管理
								</a>
							</li>
							<?php } ?>
							<?php if(checkPermission("011003")){  ?>
							<li class="">
								<a href="<?php echo site_url('admin/manager/role/index');?>" data-target="menuIframe" data-tab-title="角色管理">
									<i class="menu-icon fa fa-caret-right"></i>
									角色管理
								</a>
							</li>
							<?php } ?>
						</ul>
					</li>
				  	<?php } ?>
					
					
					<?php if(checkPermission("012")){  ?>
					<li class="">
						<a href="<?php echo site_url('admin/manager/log/index');?>" data-target="menuIframe" data-tab-title="操作日志">
							<i class="menu-icon fa fa-flag"></i>
							<span class="menu-text"> 操作日志 </span>
						</a>
					</li>
				  	<?php } ?>

				</ul><!-- /.nav-list -->

				<!-- #section:basics/sidebar.layout.minimize -->
				<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
					<i id="sidebar-toggle-icon" class="ace-icon fa fa-angle-double-left ace-save-state" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
				</div>

				<!-- /section:basics/sidebar.layout.minimize -->
			</div>

			<!-- /section:basics/sidebar -->
			<div class="iframe_box main-content">
				<div class="widget-box transparent padding-0" id="iframe_tab_box">
					<div class="widget-header" style="height: 20px;">
						<a href="javascript:;" class="pull-left widget-toolbar-ctl" data-action="prev">
								<i class="glyphicon glyphicon-chevron-left"></i>
						</a>
						<div class="widget-toolbar-box pull-left">
							<div class="widget-toolbar no-border pull-left">
								<ul class="nav nav-tabs pull-left" id="recent-tab">
								</ul>
							</div>
						</div>
						<a href="javascript:;" class="pull-left widget-toolbar-ctl" data-action="next">
								<i class="glyphicon glyphicon-chevron-right"></i>
						</a>
					</div>
					<div class="widget-body">
						<div class="widget-main padding-4">
							<div class="tab-content padding-0 hidden" id="iframe_tab_content">
							</div>
						</div><!-- /.widget-main -->
					</div><!-- /.widget-body -->
				</div>
			</div>

		</div>
		<!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script src="ace/components/jquery/dist/jquery.js"></script>

		<!-- <![endif]-->

		<!--[if IE]>
<script src="ace/components/jquery.1x/dist/jquery.js"></script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='ace/components/_mod/jquery.mobile.custom/jquery.mobile.custom.js'>"+"<"+"/script>");
		</script>
		<script src="ace/components/bootstrap/dist/js/bootstrap.js"></script>

		<!-- page specific plugin scripts -->

		<!--[if lte IE 8]>
		  <script src="ace/components/ExplorerCanvas/excanvas.js"></script>
		<![endif]-->
		<script src="ace/components/_mod/jquery-ui.custom/jquery-ui.custom.js"></script>
		<script src="ace/components/jqueryui-touch-punch/jquery.ui.touch-punch.js"></script>
		<script src="ace/components/_mod/easypiechart/jquery.easypiechart.js"></script>
		<script src="ace/components/jquery.sparkline/index.js"></script>
		<script src="ace/components/Flot/jquery.flot.js"></script>
		<script src="ace/components/Flot/jquery.flot.pie.js"></script>
		<script src="ace/components/Flot/jquery.flot.resize.js"></script>
		<script src="ace/components/bootbox.js/bootbox.js"></script>

		<!-- ace scripts -->
		<script src="ace/assets/js/src/elements.scroller.js"></script>
		<script src="ace/assets/js/src/elements.colorpicker.js"></script>
		<script src="ace/assets/js/src/elements.fileinput.js"></script>
		<script src="ace/assets/js/src/elements.typeahead.js"></script>
		<script src="ace/assets/js/src/elements.wysiwyg.js"></script>
		<script src="ace/assets/js/src/elements.spinner.js"></script>
		<script src="ace/assets/js/src/elements.treeview.js"></script>
		<script src="ace/assets/js/src/elements.wizard.js"></script>
		<script src="ace/assets/js/src/elements.aside.js"></script>
		<script src="ace/assets/js/src/ace.js"></script>
		<script src="ace/assets/js/src/ace.basics.js"></script>
		<script src="ace/assets/js/src/ace.scrolltop.js"></script>
		<script src="ace/assets/js/src/ace.ajax-content.js"></script>
		<script src="ace/assets/js/src/ace.touch-drag.js"></script>
		<script src="ace/assets/js/src/ace.sidebar.js"></script>
		<script src="ace/assets/js/src/ace.sidebar-scroll-1.js"></script>
		<script src="ace/assets/js/src/ace.submenu-hover.js"></script>
		<script src="ace/assets/js/src/ace.widget-box.js"></script>
		<script src="ace/assets/js/src/ace.settings.js"></script>
		<script src="ace/assets/js/src/ace.settings-rtl.js"></script>
		<script src="ace/assets/js/src/ace.settings-skin.js"></script>
		<script src="ace/assets/js/src/ace.widget-on-reload.js"></script>
		<script src="ace/assets/js/src/ace.searchbox-autocomplete.js"></script>

		<!-- the following scripts are used in demo only for onpage help and you don't need them -->
		<link rel="stylesheet" href="ace/assets/css/ace.onpage-help.css" />
		<link rel="stylesheet" href="ace/docs/assets/js/themes/sunburst.css" />

		<script type="text/javascript"> ace.vars['base'] = '..'; </script>
		<script src="ace/assets/js/src/elements.onpage-help.js"></script>
		<script src="ace/assets/js/src/ace.onpage-help.js"></script>
		<script src="ace/docs/assets/js/rainbow.js"></script>
		<script src="ace/docs/assets/js/language/generic.js"></script>
		<script src="ace/docs/assets/js/language/html.js"></script>
		<script src="ace/docs/assets/js/language/css.js"></script>
		<script src="ace/docs/assets/js/language/javascript.js"></script>
		<!-- 设置窗口大小 -->
		<script>
			// 设置窗口大小
			var setIframeHeight = function() {
				var height = document.documentElement.clientHeight;
				height = height - $('#navbar').height() - $('#iframe_tab_box .widget-header').height() - 16;
				$('#iframe_tab_content').css('height', height).removeClass('hidden');
			}
			$(window).on('resize', setIframeHeight).trigger('resize');
			// 打开新的tab
			var openTab = function(url, title, key) {
				var $navtabs = $('#iframe_tab_box .nav-tabs');
				var $tab = $navtabs.find('a[data-key="'+key+'"]');
				if (!$tab.length) {
					$('<li><a data-toggle="tab" data-key="'+key+'" href="#'+key+'-tab">'+'<i class="ace-icon glyphicon glyphicon-refresh"></i>'+title+'<i class="ace-icon fa fa-times"></i></a></li>').appendTo($navtabs);
					$('<div id="'+key+'-tab" class="tab-pane active" style="height: 100%;">'+
							'<iframe src="'+url+'" style="width: 100%; height: 100%; border: none;"></iframe>'+
						'</div>').appendTo('#iframe_tab_content');
						$navtabs.find('a[data-key="'+key+'"]').trigger('click');
				}
				else {
					$navtabs.find('a[data-key="'+key+'"]').trigger('click');
					// setTimeout(function() {
						$tab.trigger('click');
					// }, 100);
				}
			}
			
			$('#iframe_tab_box .widget-header').on('resize', function() {
				var $self = $(this);
				var $navbars = $self.find('.nav-tabs');
				if ($navbars.width() > $self.width()) {
					$self.addClass('showctl');
				}
				else {
					$self.removeClass('showctl');
				}
			}).on('showLast', function() {
				console.log("showLast");
				var $self = $(this);
				var $navbars = $self.find('.nav-tabs');
				var marginLeft  = Math.min(0, $self.width() - $navbars.width());
				$navbars.css('margin-left', marginLeft).data('marginLeft', marginLeft);
			}).on('next', function() {
				console.log("next");
				var $self = $(this);
				var $navbars = $self.find('.nav-tabs');
				var marginLeft = parseInt($navbars.data('marginLeft')) || 0;
				marginLeft -= 100;
				$navbars.css('margin-left', marginLeft).data('marginLeft', marginLeft);
			}).on('prev', function() {
				console.log("prev");
				var $self = $(this);
				var $navbars = $self.find('.nav-tabs');
				var marginLeft = parseInt($navbars.data('marginLeft')) || 0;
				marginLeft = Math.min(0, marginLeft + 100);
				$navbars.css('margin-left', marginLeft).data('marginLeft', marginLeft);
			}).find('.widget-toolbar-ctl').on('click', function() {
				console.log("widget-toolbar-ctl click");
				var $self = $(this);
				$('#iframe_tab_box .widget-header').trigger($self.data('action'));
			});
			// 侦听tab关闭事件
			$('#iframe_tab_box .nav-tabs').on('click', 'i.fa', function() {
				var $li = $(this).parents('li');
				var index = $li.index();
				var activeLast = false;
				if ($li.hasClass('active')) {
					activeLast = true;	
				}
				$li.remove();
				$('#iframe_tab_content .tab-pane:eq('+index+')').remove();
				if (activeLast) {
					$('#iframe_tab_box .nav-tabs li:last').find('a').trigger('click');
				}
				$('#iframe_tab_box .widget-header').trigger('resize');
			});
			
			
			$('#iframe_tab_box .nav-tabs').on('click', 'i.glyphicon', function() {
				var dataKey = $(this).parent("a").attr("data-key");
				$("#"+dataKey+"-tab").find("iframe")[0].contentWindow.location.reload(true);
			});
			
			
			var openTapWindow  = function($el){
				//var $el = $(this);
				//alert($el);
				if ($el.data('target') == 'menuIframe') {
					try {
						var key = $el.data('key');
						if (!key) {
							var key = 'iframe_tab'+parseInt(1000000 * Math.random());
							$el.data('key', key);
						}
						openTab($el.attr('href'), $el.data('tabTitle'), key);
						// 修改菜单高亮
						if (!$el.parent().hasClass('active')) {
							var $submenu = $el.parents('ul.submenu');
							var $submenuparent = false;
							// debugger;
							if ($submenu.length) {
								var $submenuparent = $submenu.parent();
								if ($submenuparent.hasClass('active')) {
									$submenuparent.find('li.active').removeClass('active');
								}
								else {
									$('#sidebar').find('li.active').removeClass('active');
									$submenuparent.addClass('active');
								}
								$el.parent().addClass('active');
							}
							else {
								$('#sidebar').find('li.active').removeClass('active');
								$el.parent().addClass('active');
							}
						}
						$('#iframe_tab_box .widget-header').trigger('resize');
					} catch(e) {
						console.error(e);
					}
					
					return false;
				}
			}
			
			// 侦听新开窗口事件
			$('#sidebar').on('click', '.nav-list a', function() {
				return openTapWindow($(this));
			}).find('.nav-list a[data-default-tab]').trigger('click');
			
		</script>
		<!-- 结束 -->
	</body>
</html>
